﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;

namespace OurMemory
{
    public partial class FormCreateHM : Form
    {
        private readonly HappyMemoriesServices service = new HappyMemoriesServices();
        public FormCreateHM()
        {
            InitializeComponent();
        }

        private void FormCreateHM_Load(object sender, EventArgs e)
        {

        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            HappyMemoriesCreateModel model = new HappyMemoriesCreateModel()
            {
                Story = textStory.Text,
                Date = dTP.Value.Date,
                Photo = textPhoto.Text,
                Recorder = textRecorder.Text,
                Feelings = textFeelings.Text,
            };
            service.Create(model);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
